1. Field of the Invention
This invention relates to the field of computer graphics, specifically real-time rendering and anti-aliasing of three-dimensional objects.
2. Description of the Related Art
Real-time computer graphics in its origins used vector displays, on which images were drawn by precisely guiding the path and intensity of an electron beam (emitted by an electron gun) across a phosphor screen to produce points, lines, curves, etc. While these vector displays were very limiting and are no longer in wide use, the shapes drawn always had very smooth edges because the electron beam was manipulated according to the exact equation describing the line or curve being drawn, onto a uniform (gridless) phosphor screen, resulting in little to no quantization of the signal.
Later, when memory became inexpensive enough for the first frame buffers, real-time computer graphics moved onto raster displays. Raster displays, like television screens, are organized into picture elements (pixels) arrayed upon a uniform grid across the screen. Rather than trace out the specific equations of geometric constructs, the electron gun moves across each row of pixels until the entire screen has been scanned. The image on the screen is created by varying the intensity of the electron beam as it strikes each pixel. Color displays were later made possible by depositing three overlapping grids of phosphors (red, green, blue) on the screen, with a slight offset applied to each grid to group the red, green, and blue subpixels into pixels. Three electron guns are employed to light the phosphors respectively.
In addition to enabling color display, raster displays also enabled rendering of filled (as opposed to wireframe) surfaces, which, with the addition of real-time lighting, texture mapping, and other rendering techniques eventually led to more realistic interactive experiences. Unfortunately, the smooth lines were replaced by “baggy” lines and polygon edges which flicker and swim when animated. These visual artifacts caused by the quantization of curves and surfaces onto a grid are referred to aliasing. They are caused during the process of computing pixel coverage for a surface. One conventional way of deciding whether to light a pixel is to determine whether the pixel is covered by a polygon, e.g. by selecting pixels whose centers lie within the boundaries of the polygon, and lighting only the covered pixels. Another way is to light each pixel containing any part of the polygon. Aliasing results from each of these methods. For example, FIG. 1A illustrates a line 102a passing through a grid 104, wherein each square of the grid represents a pixel. FIG. 1B illustrates how the line 102b would be rendered if each pixel through which the line 102a passes is lit The aliasing of line 102b in FIG. 1B is clear, resulting in a number of jagged edges that make the line look unnatural. Aliasing is a problem that is well known in the art of computer graphics.
Many approaches have been developed for eliminating aliasing of objects, i.e. antialiasing, most of which rely upon coloring pixels proportionally to the amount by which a surface overlaps that pixeL That proportion is encoded using a coverage value that blends fragments generated by each primitive with the preexisting pixel color in the frame buffer. Some approaches use primitive antialiasing, in which each primitive (e.g. line, triangle, point), is antialiased independently as it is drawn, and then the resulting pixels are combined whole to produce the final image. This technique is most widely used as line antialiasing for CAD applications. Primitive antialiasing is problematic for solid surfaces because it is order-dependent. For example, suppose the frame buffer is cleared to black and then two polygons (red in the foreground and blue in the background) are drawn such that they partially overlap, and primitive antialiasing is used. Also, assume hidden surface removal is employed. If the foreground polygon is drawn after the background polygon, the edges appear as expected, with edges of the blue background polygon fading into the black void, the overlapping edges of the red foreground polygon fading into blue, and the non-overlapping edges of the red foreground polygon fading into the black void. If, however the polygons are drawn in the reverse order, with the background drawn after the foreground, then the overlapping edges of the red foreground polygon will fade from red to black, which is in error and will destroy any benefits gained from antialiasing.
As a result of this order-dependent phenomenon, scenes employing conventional primitive antialiasing must be sorted such that polygons are drawn from back to front, which is excessively computationally intensive for scenes of reasonable complexity. For this reason, full-scene antialiasing (FSAA) was developed. Full-scene antialiasing techniques generally divide each pixel into a plurality of samples, which are stored separately in the frame buffer, and then combined when the frame buffer is read by the digital-to-analog converter (DAC) for display. The predominant FSAA technique is called Multisampling, and is described for example in U.S. Pat. No. 6,072,500. Multisampling is not without a performance impact, however. Frame-buffer memory bandwidth is generally the limiting factor in real-time rendering performance, and because N-times as many samples as pixels must be rendered, nearly N-times the bandwidth is required. Because of memory coherency optimizations, overall performance is not generally degraded by a factor of N, but FSAA nonetheless has a high cost, particularly at high resolutions.
Also, because aliasing occurs principally at the edges of surfaces, only a tiny fraction of the pixels in some scenes may exhibit aliasing. Scenes comprised primarily of large solid (as opposed to wireframe) surfaces exhibit this characteristic. For such scenes, FSAA might be considered overkill. It is desirable to apply antialiasing selectively, where it is needed most, based on the requirements of the application and perceptual factors such as the degree of contrast across an edge. Also, in systems capable of FSAA, it is desirable to enhance the antialiasing on certain critical objects. For example, in a flight simulator, it is important to be able to identify other aircraft at a distance, when they are made very small by projection. Aliasing makes this identification very difficult because it distorts the shape of the aircraft and causes it to shimmer and flicker as it moves across the screen. In situations such as this, it is desirable to apply the maximum degree of antialiasing possible to the critical object, even though it may not be desirable to apply maximum antialiasing to the whole scene, because of performance considerations.
For some pathological object configurations, the degree of aliasing vastly exceeds the ability of existing real-time antialiasing technology. In general, high contrast, long and thin objects are not easy to antialias in real time. One example of this phenomenon is that of runway lines, as might be seen within a flight simulator. It is important for a pilot to be able to recognize runway markings at a distance—however, runway lines are long and thin, which results in sub-pixel-width polygons (as projected into screen-space), which are the most difficult to antialias; and runway lines are generally very high contrast, such as white lines on a black asphalt tarmac, which makes the aliasing extremely visible, and therefore disagreeable. Thus, a better solution for antialiasing runway lines is needed.
Accordingly, there is a need for a system and method for improved antialiasing of objects in a scene.